package com.frxuexi.mdm2204.demo

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.frxuexi.mdm2204.R

@Composable
fun Demo01(){
    //垂直布局
    /*Column {
        Text(text = "hello")
        Text(text = "world")
    }*/
    //水平布局
    Row {
        Image(painter = painterResource(id = R.drawable.ic_launcher_background), contentDescription = "",
            modifier = Modifier
                .size(60.dp)//大小
//                .clip(CircleShape)//圆角
                .clip(RoundedCornerShape(20.dp))//圆形
        )


        Column {
            Text(text = stringResource(id = R.string.app_name) )
            Text(text = "helloxdcfghjkfghjkfghnm,ghjnmvbnm",
//                color = Color.Gray//文本颜色
                color = colorResource(id = R.color.purple_200),
                fontSize = 22.sp,//文字大小
                fontWeight = FontWeight.Bold,//加粗
                letterSpacing = 3.sp,//文字之间间隔
//                textAlign = TextAlign.Center,
                maxLines = 1,//最大行数
                overflow = TextOverflow.Ellipsis,//文字超出时…
                modifier = Modifier.width(200.dp)
            )


        }

    }
}